<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
		<style type="text/css">
			.container {
			            width: 600px;
			            height: 600px;
			            border: 1px solid;
			            display: flex;
			            flex-wrap: wrap;
			            margin: 100px auto;
			        }
			
			        .block {
			            width: 33.33%;
			            height: 33.33%;
			            outline: 1px solid black;
			            text-align: center;
			            line-height: 200px;
			            font-size: 26px;
			        }
			
			        .block5 {
			            background-color: skyblue;
			            cursor: pointer;
			        }
		</style>
	</head>
	<body>
		<div class="container">
		        <div class="block1 block">小米笔记本</div>
		        <div class="block2 block">iPhoneX</div>
		        <div class="block3 block">PS4游戏机</div>
		        <div class="block4 block">谢谢参与</div>
		        <div class="block5 block">开始抽奖</div>
		        <div class="block6 block">索尼电视机</div>
		        <div class="block7 block">西门子冰箱</div>
		        <div class="block8 block">老板抽油烟机</div>
		        <div class="block9 block">空气净化机</div>
		    </div>
	</body>
	
	<script type="text/javascript">
		let blocks = document.getElementsByClassName("block");
		      
		        let arr = [0, 1, 2, 5, 8, 7, 6, 3], i = 0, count = 0, stopTimer;
		        let rand = Math.floor(Math.random()*8+50); 
		        let around = function () {
		           
		            for (let j = 0; j < arr.length; j++) {
		                blocks[arr[j]].style.background = "white";
		            }
		           
		            blocks[arr[i]].style.background = "pink";
		            i++; 
		           
		            if (i === arr.length) {
		                i = 0;
		            }
		             count++; 
		            if (count === rand) {
		                clearInterval(stopTimer);
		            }
		        }
		       
		        let start = function () {
		            blocks[4].removeEventListener("click", start); 
		            stopTimer = setInterval(around, 100);
		        }
		        blocks[4].addEventListener("click", start);
				
	</script>
</html>
